package cn.cms.service;

import cn.cms.dao.PageDao;
import cn.cms.dao.RankDao;
import cn.cms.model.Rank;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RankService {

    @Autowired
    private RankDao rankDao;

    public PageDao<Rank> getListPage(PageDao<Rank> pageDao, Rank rank) {
        List<Rank> ranks = rankDao.getList(pageDao, rank);
        pageDao.setResult(ranks);
        return pageDao;
    }

    public Rank getById(Long id) {
        return rankDao.getById(id);
    }

    public void del(Rank rank) {
        rankDao.delete(rank);
    }

    public void save(Rank rank) {
        rankDao.save(rank);
    }

    public void update(Rank rank) {
        rankDao.update(rank);
    }

    public void icrSortAll() {
        rankDao.icrSortAll();
    }

    public List<Rank> getAll() {
        List<Rank> ranks = rankDao.getAll();
        return ranks;
    }

}
